package com.xr.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MPConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        //1.创建MyBatisPlus的拦截器栈,这个时候拦截器栈中没有具体的拦截器
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //2.初始化了分页拦截器，并添加到拦截器栈中
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }
}
